Welcome Guest

Technical Questions for GOLDMAN SACHS

Q. No. :1
Question :If one uses straight two-way merge sort algorithm to sort the following elements in ascending order:
20,47,15,8,9,4,40,30,12,17
then the order of those elements after the second pass of the algorithm is
A :
8,9,15,20,47,4,12,17,30,40
B :
8,15,20,47,4,9,30,40,12,17
C :
15,20,47,4,8,9,12,30,40,17
D :
4,8,9,15,20,47,12,17,30,40
Answer: B
Q. No. :2
Question : A Priority-Queue is implemented as a Max-Heap. Initially, it has 5 elements. The level-order traversal of the heap is given below: 10, 8,5,3,2 Two new elements 1 and 7 are inserted in the heap in that order. The level-order traversal of the heap after the insertion of the elements is :
A :
10,8,7,5,3,2,1
B :
10,8,7,2,3,1,5
C :
10,8,7,1,2,3,5
D :
10,8,7,3,2,1,5
Answer: D
Q. No. :3
Question :The following numbers are inserted into an empty binary search tree in the given order: 10, 1, 3, 5, 15, 12, 16. What is the height of the binary search tree (the height is the maximum distance of a leaf node from the root)?
A :
2
B :
3
C :
4
D :
5
Answer: B
Q. No. :4
Question :A hash table implementation uses function of (% 7) and linear probing to resolve collision. What is the ratio of numbers in the following series with out collision and with collision if 7 buckets are used: 32, 56, 87, 23, 65, 26, 93
A :
2,5
B :
3,4
C :
4,3
D :
5,2
Answer: C
Q. No. :5
Question : A computer company wants to hire 25 programmers to handle systems programming jobs and 40 programmers for applications programming. Of those hired 10 will be expected to perform jobs of both types. How many programmers must be hired?
A :
65
B :
45
C :
75
D :
55
Answer: D
Q. No. :6
Question : What will be the output of the program ?
#include<stdio.h>
#include<string.h>

int main()
{
    int i, n;
    char *x="Alice";
    n = strlen(x);
    *x = x[n];
    for(i=0; i<=n; i++)
    {
        printf("%s ", x);
        x++;
    }
    printf("\n", x);
    return 0;
}

A :
Alice
B :
ecilA
C :
Alice lice ice ce e
D :
lice ice ce e
Answer: D
Q. No. :7
Question :Consider the following declarations
 void main()
{ int n,x;
sacnf("%d", &n);
for(x=0;x<=n;x++)
{
if(n%x==0)
break;
}
if(x<=n+1)
{
printf("...................");
else
printf("...................");
}
}
Fill the blanks:-
A :
Divisible by n/2, not Divisible by n/2
B :
palindrome number, not a palindrome number
C :
Prime number, not Prime number
D :
Divisible by all even number, not divisible by odd number
Answer: C
Q. No. :8
Question :Which of the following statements is correct?
(i) A static variable may be either an internal type or an external type, depending on the place of declaration.
(ii) Internal static variables are those which are declared inside a function. The scope of internal static variables extends upto the end of the function in which they are defined.
(iii) The Internal static variables are similar to auto variables, except that they are remain in existence through out the remainder of the program.
A :
(i)&(ii)
B :
(ii)&(iii)
C :
(i)&(iii)
D :
(i),(ii),(iii)
Answer: D
Q. No. :9
Question :Trace the output:-
 main()
{
int i=0,x=0;
for(i=0;i<10;++i)
{
if(i%2==1)
x+=1;
else
x--;
printf("%d",x);
break;
  }
}

A :
1 0 3 2 7 6 13 12 21
B :
1 0 3 2 7 6 12 13
C :
1
D :
1 0 3 2 7 6 12 13 21
Answer: C
Q. No. :10
Question :Trace the output :
 #include<stdio.h>
typedef union
{ int i;
float f;
} udef;
udef funct (udef u);
main()
{udef u;
u.i=100;
u.f=0.5;
u=funct(u);
printf("%d%f\n", u.i, u.f);
}
udef funct (udef u)
{u.f= -0.3;
printf("%d%f\n", u.i, u.f);
return(u);
}

A :
garbage -0.3
garbage garbage
B :
100 0.5
garbage -0.3
C :
garbage -0.300000
garbage -0.300000
D :
Error
Answer: C